<template>
    <div id="tmpl">
        <h4 v-html="info.title">标题</h4>
        <p class="line"></p>
        <p v-html="info.content"></p>
    </div>
</template>

<script>
    import common from '../../kits/common.js';
    import {Toast} from 'mint-ui';

    export default {
        data() {
            return{
                id:0, //代表的时当前商品的id
                info:     {
                    "title": "Vue从入门到住院",
                    "content": "<h1>Vue 从入门到。。。</h1><p> 核心技术从入门到.......</p><p>测试..测试..测试..测试..测试..测试..测试..测试..测试..测试..测试.测试..测试..测试..测试..测试..测试..测试..测试..测试..测试..测试..测试..测试..测试..测试..测试..</p>"
                }
            }
        },
        created() {
            this.id = this.$route.params.id;
            this.getinfo();
        },
        methods: {
            getinfo() {
                var url = common.apidomain + '/GoodContent?id=' + this.id;
                this.$http.get(url).then(function (resp) {
                    if (resp.body.status != 0) {
                        Toast(resp.body.message);
                        return;
                    }

                    this.info = resp.body.message[0];
                })
            }
        }
    }
</script>

<style scoped>
    #tmpl{
        padding: 5px;
    }
    #tmpl h4 {
        color: #0094ff;
    }

    #tmpl .line {
        height: 1px;
        border: 1px solid rgba(0,0,0,0.3);
    }

</style>